package com.zwj;

import lombok.extern.slf4j.Slf4j;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.core.env.Environment;
import org.springframework.util.StringUtils;

import java.net.InetAddress;
import java.net.UnknownHostException;
@Slf4j
@SpringBootApplication
@MapperScan({"com.zwj.mapper"})
public class OLSpringApplication {
    public static void main(String[] args) {
        //SpringApplication.run(OLSpringApplication.class,args);
        ConfigurableApplicationContext applicationContext = SpringApplication.run(OLSpringApplication.class, args);
        Environment env = applicationContext.getEnvironment();
        String ip = null;
        try {
            ip = InetAddress.getLocalHost().getHostAddress();
        } catch (UnknownHostException e) {
            e.printStackTrace();
        }
        String port = env.getProperty("server.port");
        String path = env.getProperty("server.servlet.context-path");
        if (StringUtils.isEmpty(path)) {
            path = "";
        }

        log.info("\n\t----------------------------------------------------------\n\t" +
                "Swagger文档本地访问网址: \t\t http://localhost:" + port + path + "/doc.html" + "\n\t" +
              // "首页访问地址: \t\t\t\t http://localhost:" + port + path + "/login.html" + "\n\t" +
                "----------------------------------------------------------");
    }
    }

